home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / darts06.zip / DARTGUN.QC < prev    next >
Text File  |  1996-08-30  |  4KB  |  148 lines

  1. float   showedmotd;
  2.  
  3. /*
  4. ===============================================================================
  5.  
  6. DART STUFF
  7.  
  8. ===============================================================================
  9. */
  10.  
  11. void() dartdamage =
  12. {
  13.  if (self.darts > 0)
  14.   if (time >= self.darttime)
  15.    {
  16.     T_Damage(self,self.dart_inflictor,self.dart_attacker,self.darts*2);
  17.     self.darttime = time + 3 ;
  18.    }
  19. };
  20.  
  21. void() dart_touch =
  22. {
  23. local float rand;
  24.     if (other == self.owner)
  25.         return;
  26.  
  27.     if (other.solid == SOLID_TRIGGER)
  28.         return;    // trigger field, do nothing
  29.  
  30.     if (pointcontents(self.origin) == CONTENT_SKY)
  31.     {
  32.         remove(self);
  33.         return;
  34.         }                                     //kb 
  35.     
  36. // hit something that bleeds
  37.     if (other.takedamage)
  38.     {
  39.         spawn_touchblood (9);
  40.         T_Damage (other, self, self.owner, 3);
  41.                 if (other.classname == "player")
  42.                  stuffcmd(other,"bf\n");
  43.                 other.darts = other.darts + 1 ;
  44.                 other.dart_inflictor = self ;
  45.                 other.dart_attacker = self.owner;
  46.                 if (other.health <= 0)
  47.                  other.deathtype = "poison";
  48.     }
  49.     else
  50.     {
  51.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  52.         
  53.         if (self.classname == "wizspike")
  54.             WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
  55.         else if (self.classname == "knightspike")
  56.             WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
  57.         else
  58.             WriteByte (MSG_BROADCAST, TE_SPIKE);
  59.         WriteCoord (MSG_BROADCAST, self.origin_x);
  60.         WriteCoord (MSG_BROADCAST, self.origin_y);
  61.         WriteCoord (MSG_BROADCAST, self.origin_z);
  62.     }
  63.  
  64.     remove(self);
  65.  
  66. };
  67.  
  68.  
  69. void(vector org, vector dir) launch_dart =
  70. {
  71.     newmis = spawn ();
  72.     newmis.owner = self;
  73.     newmis.movetype = MOVETYPE_FLYMISSILE;
  74.     newmis.solid = SOLID_BBOX;
  75.  
  76.     newmis.angles = vectoangles(dir);
  77.                                                  
  78.     newmis.touch = dart_touch;
  79.     newmis.classname = "spike";
  80.     newmis.think = SUB_Remove;
  81.     newmis.nextthink = time + 6;
  82.     setmodel (newmis, "progs/spike.mdl");
  83.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  84.     setorigin (newmis, org);
  85.  
  86.     newmis.velocity = dir * 1000;
  87. /*
  88.                 T_Damage (self, self, self, 3);
  89.                 self.darts = self.darts + 1 ;
  90.                 self.dart_inflictor = self ;
  91.                 self.dart_attacker = self;
  92. */
  93.    //testing. fire a dart, take a dart. kb
  94. };
  95.  
  96. void(float ox) W_FireDarts =
  97. {
  98.     local vector    dir;
  99.     local entity    old;
  100.     
  101.     makevectors (self.v_angle);
  102.  
  103. /*
  104.     if (self.ammo_nails >= 2 && self.weapon == IT_SUPER_NAILGUN)
  105.     {
  106.         W_FireSuperSpikes ();
  107.         return;
  108.     }
  109. */
  110.  
  111.     if (self.ammo_nails < 1)
  112.     {
  113.         self.weapon = W_BestWeapon ();
  114.         W_SetCurrentAmmo ();
  115.         return;
  116.     }
  117.  
  118.     self.attack_finished = time + 0.2;
  119.     self.currentammo = self.ammo_nails = self.ammo_nails - 1;
  120.     dir = aim (self, 1000);
  121.         launch_dart (self.origin + '0 0 16' + v_right*ox, dir);
  122.  
  123.     sound (self, CHAN_WEAPON, "weapons/guncock.wav", 1, ATTN_NORM);
  124.  
  125.     self.punchangle_x = -2;
  126. };
  127.  
  128. //============================================================================
  129.  
  130. $frame nailatt1 nailatt2
  131.  
  132. void()  player_dart1 =  [$nailatt1, player_dart2        ] {self.weaponframe=1;
  133. self.effects = self.effects | EF_MUZZLEFLASH;};
  134. void()  player_dart2 =  [$nailatt2, player_run        ] {self.weaponframe=2;};
  135.  
  136. //*************************************************************************
  137.  
  138. void() dartmsg =
  139. {
  140.  if (showedmotd != 666)
  141.   {
  142.    sprint(self,"This server has the following modifications : \n");
  143.    sprint(self,"Poison Dart Gun v0.6. Hit 4 with the nailgun selected, or bind a key to \"impulse 12\" to select.\n");
  144.    sprint(self," Mail kevin_bowen@juno.com for dartgun bugs/questions/suggestions.\n");
  145.    showedmotd = 666 ;
  146.   }
  147. };
  148.